﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BLL.Model.Voucher
{
    public class ContraFactory
    {
        public Contra NewContra(string bankBookOrCashBook, string contraType)
        {
            Contra contra = default(Contra);
            switch (bankBookOrCashBook)
            {
                case "BankBook":
                    contra = new BankBookContra { ContraType = contraType };
                    break;
                case "CashBook":
                    contra = new CashBookContra { ContraType = contraType };
                    break;
                default:
                    throw new Exception("bankBookOrCashBook can be only BankBook or CashBook");
            }
            return contra;
        }
    }
}
